package com.jake.springboot.order.constant;

public enum OrderTypeEnum {
    /**
     * 即时
     */
    INSTANT(1, "即时订单"),


    /**
     * 预订
     */
    BOOKING(2, "预约订单"),


    /**
     * 拼车
     */
    CARPOOL(3, "拼车订单");

    private final int code;

    private final String description;

    OrderTypeEnum(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public int getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static OrderTypeEnum getByCode(int code) {
        for (OrderTypeEnum orderTypeEnum : values()) {
            if (orderTypeEnum.getCode() == code) {
                return orderTypeEnum;
            }
        }
        return null;
    }

}
